﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            background-image:url('/images/ground.jpg');
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }

        .login-container {
            background-color: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            width: 350px;
        }

        .login-header {
            text-align: center;
            margin-bottom: 25px;
        }

            .login-header h1 {
                color: #333;
                font-size: 24px;
                margin-bottom: 10px;
            }

        .form-group {
            margin-bottom: 20px;
        }

            .form-group label {
                display: block;
                margin-bottom: 8px;
                font-weight: 600;
                color: #555;
            }

            .form-group input {
                width: 100%;
                padding: 10px;
                border: 1px solid #ddd;
                border-radius: 4px;
                font-size: 16px;
                box-sizing: border-box;
            }

                .form-group input:focus {
                    border-color: #4285f4;
                    outline: none;
                    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
                }

        .login-button {
            width: 100%;
            padding: 12px;
            background-color: #4285f4;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: background-color 0.3s;
        }

            .login-button:hover {
                background-color: #3367d6;
            }

        .login-footer {
            text-align: center;
            margin-top: 20px;
            color: #666;
        }

            .login-footer a {
                color: #4285f4;
                text-decoration: none;
            }

                .login-footer a:hover {
                    text-decoration: underline;
                }

        .error-message {
            color: #d32f2f;
            font-size: 14px;
            margin-top: 5px;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="login-header">
            <h1>欢迎登录</h1>
        </div>

        <form id="loginForm" onsubmit="return validateForm()" action="~/home/loginfrom" method="post">
            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" id="username" name="username" placeholder="请输入用户名" required>
                <div id="usernameError" class="error-message"></div>
            </div>

            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" id="password" name="password" placeholder="请输入密码" required>
                <div id="passwordError" class="error-message"></div>
            </div>

            <button type="submit" class="login-button">登录</button>
        </form>

        <div class="login-footer">
            <p><a href="#">忘记密码？</a></p>
        </div>
    </div>

    <script>
        function validateForm() {
            let isValid = true;
            // 清除之前的错误信息
            document.getElementById('usernameError').textContent = '';
            document.getElementById('passwordError').textContent = '';
            return isValid;
        }
    </script>
</body>
</html>